home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3dm / audio / alGetResourceByName.z / alGetResourceByName
Encoding:
Text File  |  1998-10-20  |  6.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))                              aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      alGetResourceByName - find an audio resource by name
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
  13.  
  14.      iiiinnnntttt aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((iiiinnnntttt ssssttttaaaarrrrtttt____rrrreeeessss,,,, cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, iiiinnnntttt ttttyyyyppppeeee))))
  15.  
  16. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  17.      _s_t_a_r_t__r_e_s
  18.             expects a resource at which the name search is to begin. Typically
  19.             this is AL_SYSTEM, the top of the audio resource hierarchy.
  20.  
  21.      _n_a_m_e   is a character string describing the resource to be found.
  22.  
  23.      _t_y_p_e   is the type of the desired resource.
  24.  
  25. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.      aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee searches the resources accessible from _s_t_a_r_t__r_e_s for
  27.      a resource of type _t_y_p_e which has a resource matching the given _n_a_m_e
  28.      accessible to it. See aaaallllRRRReeeessssoooouuuurrrrcccceeeessss((((3333ddddmmmm)))) for general information on
  29.      resources, resource types, and the resource hierarchy.
  30.  
  31.      There are three ways for _n_a_m_e to match a given resource. The first is
  32.      when _n_a_m_e exactly matches the resource's name (AL_NAME).  The second is
  33.      when _n_a_m_e exactly matches the resource's label (AL_LABEL). The third is
  34.      when _n_a_m_e specifies a type which matches the type of the resource. The
  35.      search is performed in this order.
  36.  
  37.      Periods in the name act as qualifiers. A name of the form (A.B) matches
  38.      resource B if and only if it is accessible from resource A.
  39.  
  40. EEEEXXXXAAAAMMMMPPPPLLLLEEEE NNNNAAAAMMMMEEEESSSS
  41.      "AnalogIn"
  42.           matches a resource named "AnalogIn"
  43.  
  44.      "in.analog"
  45.           matches an analog interface accessible from an input device.
  46.  
  47.      "out.analog"
  48.           matches an analog interface accessible from an output device.
  49.  
  50.      "RAD1.microphone"
  51.           matches a microphone interface accessible from a resource called
  52.           "RAD1"
  53.  
  54.      "A2.out.analog"
  55.           matches an analog interface accessible from an output device
  56.           accessible from a resource called "A2"
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))                              aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74. EEEEXXXXAAAAMMMMPPPPLLLLEEEE CCCCOOOODDDDEEEE
  75.      The following code fragment finds a device _d_e_v which can access the
  76.      resource which matches _n_a_m_e, and, if the named resource is an interface,
  77.      selects that interface on the device. For example, if _n_a_m_e were
  78.      "microphone," this code will look for a device _d_e_v with a microphone
  79.      input, and select that input on the device.
  80.  
  81.           int dev;
  82.  
  83.           dev = alGetResourceByName(AL_SYSTEM, name, AL_DEVICE_TYPE);
  84.           if (!dev) {
  85.               printf("invalid device %s0, name);
  86.               exit(-1);
  87.           }
  88.           if (itf = alGetResourceByName(AL_SYSTEM, name, AL_INTERFACE_TYPE)) {
  89.               /*
  90.                * the named resource is an interface. Select the interface on the
  91.                * given device.
  92.                */
  93.               ALpv p;
  94.  
  95.               p.param = AL_INTERFACE;
  96.               p.value.i = itf;
  97.               if (alSetParams(dev, &p, 1) < 0 || p.sizeOut < 0) {
  98.                   printf("set interface failed0);
  99.               }
  100.  
  101.           }
  102.           [... now do something with src...]
  103.  
  104.  
  105. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  106.      If aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee is successful, it returns a non-zero resource. If
  107.      it fails, it returns 0 and sets an error code which can be retrieved with
  108.      oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))). The error codes returned include:  aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee can
  109.      fail for the following reasons:
  110.  
  111.      AAAALLLL____BBBBAAAADDDD____BBBBUUUUFFFFFFFFEEEERRRRLLLLEEEENNNNGGGGTTTTHHHH
  112.           _n_a_m_e is too long.
  113.  
  114.      AAAALLLL____BBBBAAAADDDD____DDDDEEEEVVVVIIIICCCCEEEE____AAAACCCCCCCCEEEESSSSSSSS
  115.           There is no audio system available, or it is improperly configured.
  116.  
  117.      AAAALLLL____BBBBAAAADDDD____RRRREEEESSSSOOOOUUUURRRRCCCCEEEE
  118.           _s_t_a_r_t__r_e_s is an invalid resource.
  119.  
  120.      AAAALLLL____BBBBAAAADDDD____NNNNOOOOTTTT____FFFFOOOOUUUUNNNNDDDD
  121.           A resource could not be found which met the given criteria.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))                              aaaallllGGGGeeeettttRRRReeeessssoooouuuurrrrcccceeeeBBBByyyyNNNNaaaammmmeeee((((3333ddddmmmm))))
  137.  
  138.  
  139.  
  140. SEE ALSO
  141.      oserror(3C), alIntro(3dm), alSetDevice(3dm), alResources(3dm)
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.